/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author elfatah
 */
@Entity
@Table(name = "barang")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Barang.findAll", query = "SELECT b FROM Barang b"),
    @NamedQuery(name = "Barang.findByBarangId", query = "SELECT b FROM Barang b WHERE b.barangId = :barangId"),
    @NamedQuery(name = "Barang.findByKodeBarang", query = "SELECT b FROM Barang b WHERE b.kodeBarang = :kodeBarang"),
    @NamedQuery(name = "Barang.findByJumlahStok", query = "SELECT b FROM Barang b WHERE b.jumlahStok = :jumlahStok"),
    @NamedQuery(name = "Barang.findByIdJenis", query = "SELECT b FROM Barang b WHERE b.idJenis = :idJenis"),
    @NamedQuery(name = "Barang.findByHargaBarang", query = "SELECT b FROM Barang b WHERE b.hargaBarang = :hargaBarang")})
public class Barang implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "BARANG_ID")
    private Integer barangId;
    @Column(name = "KODE_BARANG")
    private String kodeBarang;
    @Column(name = "JUMLAH_STOK")
    private Integer jumlahStok;
    @Column(name = "ID_JENIS")
    private Integer idJenis;
    @Column(name = "HARGA_BARANG")
    private String hargaBarang;

    public Barang() {
    }

    public Barang(Integer barangId) {
        this.barangId = barangId;
    }

    public Integer getBarangId() {
        return barangId;
    }

    public void setBarangId(Integer barangId) {
        this.barangId = barangId;
    }

    public String getKodeBarang() {
        return kodeBarang;
    }

    public void setKodeBarang(String kodeBarang) {
        this.kodeBarang = kodeBarang;
    }

    public Integer getJumlahStok() {
        return jumlahStok;
    }

    public void setJumlahStok(Integer jumlahStok) {
        this.jumlahStok = jumlahStok;
    }

    public Integer getIdJenis() {
        return idJenis;
    }

    public void setIdJenis(Integer idJenis) {
        this.idJenis = idJenis;
    }

    public String getHargaBarang() {
        return hargaBarang;
    }

    public void setHargaBarang(String hargaBarang) {
        this.hargaBarang = hargaBarang;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (barangId != null ? barangId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Barang)) {
            return false;
        }
        Barang other = (Barang) object;
        if ((this.barangId == null && other.barangId != null) || (this.barangId != null && !this.barangId.equals(other.barangId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.Barang[ barangId=" + barangId + " ]";
    }
    
}
